package activity

import android.content.Intent
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.widget.Toast
import androidx.activity.viewModels
import androidx.recyclerview.widget.LinearLayoutManager
import apdate.SquareApdate
import com.wd.common.base.BaseActivity
import com.wd.common.viewmodel.MyViewModel
import com.wd.rim.R
import com.wd.rim.databinding.ActivityTalkBinding

class TalkActivity : BaseActivity<ActivityTalkBinding,Any?>() {
    val mViewModel:MyViewModel by viewModels()
    private var apdate: SquareApdate?=null
    override fun getViewBinding()= ActivityTalkBinding.inflate(layoutInflater)
    override fun initData() {
        val intent=intent
        val Id = intent.getStringExtra("HotId")
        val Name1 = intent.getStringExtra("name")
        binding.name.setText(Name1)
        mViewModel.getRecom(1,10)
        mViewModel.Recom.observe(this){
            if (it.status.equals("110")){

                Toast.makeText(this,it.message, Toast.LENGTH_SHORT)

            }else{
                apdate=this?.let {it1-> SquareApdate(it1,it) }
                binding.recyId.layoutManager= LinearLayoutManager(this)
                binding.recyId.adapter=apdate
            }
        }

        binding.send.setOnClickListener {
            val intent1 = Intent()
            intent1.setClass(this,ReleaseActivity::class.java)
            startActivity(intent1)
        }

    }

}